/*
  ==============================================================================

    VSTRenderLib.h
    Created: 28 Nov 2024 11:39:06am
    Author:  leis

  ==============================================================================
*/



#ifndef VSTRENDER_LIBRARY_H
#define VSTRENDER_LIBRARY_H

#ifdef __cplusplus
extern "C" {
#endif
	typedef void (*CallbackFunction)(const char*);
	static bool initialed = false;
	/// <summary>
	/// call this first
	/// </summary>
	/// <param name="initInstanceNum">how many instances to create in first time</param>
	/// <param name="maxInstanceNum">max number of instances</param>
	/// <param name="pluginNums">number of plugins in plugin chains</param>
	/// <param name="pluginDescPaths">plugin describe xml file path array</param>
	/// <param name="pluginPresetPaths">plugin preset file path array</param>
	/// <returns></returns>
	bool Init(int initInstanceNum,int maxInstanceNum,int pluginNums,
		const char** pluginDescPaths, const char** pluginPresetPaths,int bufferSize=512);
	/// <summary>
	/// process audio file
	/// </summary>
	/// <param name="inputPath"></param>
	/// <param name="outputPath"></param>
	/// <param name="extendTail">some plugin like delay may create tail,better to set around 1s or more to extend audio length</param>
	/// <param name="speed">1 is original speed,0.5-2</param>
	/// <param name="cb">cb param is a string,if success,it would be "success"</param>
	void ProcessAudioFile(const char* inputPath,const char* outputPath,float extendTail,float speed, CallbackFunction cb);
	/// <summary>
	/// call this to release resources
	/// </summary>
	bool Exit();
	bool InitRealTime(int pluginNums,const char** pluginDescPaths, const char** pluginPresetPaths, int size,int sampleRate);
	void ProcessAudioBufferRealTime(float* buffer, int bufferSize, int channelNum);
#ifdef __cplusplus
}
#endif

#endif